//
//  LeftControlLayer.m
//  Soccer
//
//  Created by Hyun-Woong Kim on 09. 04. 28.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "InputLayer.h"
#import "ClientManager.h"

#define dragMin 3

@implementation InputLayer

- (id)init
{
	if (self = [super init])
	{
		self.isTouchEnabled = YES;
		self.isAccelerometerEnabled = YES;
	}	
	return self;
}

- (BOOL)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
	[[ClientManager sharedManager].inputProcessor touchBegan:touches withEvent:event];
	return kEventHandled;
}

- (BOOL)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
	[[ClientManager sharedManager].inputProcessor touchMoved:touches withEvent:event];	
	return kEventHandled;
}

- (BOOL)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
	[[ClientManager sharedManager].inputProcessor touchEnded:touches withEvent:event];
	return kEventHandled;
}

- (BOOL)ccTouchesCanceled:(NSSet *)touches withEvent:(UIEvent *)event
{
	[[ClientManager sharedManager].inputProcessor touchCanceled:touches withEvent:event];
	return kEventHandled;
}

// UIAccelerometerDelegate method, called when the device accelerates.
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
	[[ClientManager sharedManager].inputProcessor accelerometer:accelerometer didAccelerate:acceleration];
}

@end
